package application

import (
	"ruoyi/domain/entity/common"
	"ruoyi/domain/entity/monitor"
	"ruoyi/domain/entity/response"
	"ruoyi/domain/repository"
)

type JobApp struct {
	job repository.SysJobRepository
}

var _ JobAppInterface = &JobApp{}

type JobAppInterface interface {
	SelectJobList(params common.SearchTableDataParam, isPage bool) ([]monitor.SysJob, int64)

	FindJobById(jobId string) monitor.SysJob

	SaveJob(jobParam monitor.SysJobParam, userId interface{}) response.Response

	UploadJob(jobParam monitor.SysJob, userId interface{}) response.Response

	SelectJobLogList(params common.SearchTableDataParam) ([]monitor.SysJobLog, int64)

	FindJobLogById(id string) response.Response
	JobLogAdd(param monitor.SysJobLog) response.Response
	ChangeStatus(jobId string, status string)
	DeleteJob(jobIds string)
	ClearJobLog() response.Response
}

func (j *JobApp) SelectJobList(params common.SearchTableDataParam, isPage bool) ([]monitor.SysJob, int64) {
	return j.job.SelectJobList(params, isPage)
}

func (j *JobApp) FindJobById(jobId string) monitor.SysJob {
	return j.job.FindJobById(jobId)
}

func (j *JobApp) SaveJob(jobParam monitor.SysJobParam, userId interface{}) response.Response {
	return j.job.SaveJob(jobParam, userId)
}

func (j *JobApp) UploadJob(jobParam monitor.SysJob, userId interface{}) response.Response {
	return j.job.UploadJob(jobParam, userId)
}

func (j *JobApp) SelectJobLogList(params common.SearchTableDataParam) ([]monitor.SysJobLog, int64) {
	return j.job.SelectJobLogList(params)
}

func (j *JobApp) FindJobLogById(id string) response.Response {
	return j.job.FindJobLogById(id)
}

func (j *JobApp) JobLogAdd(param monitor.SysJobLog) response.Response {
	return j.job.JobLogAdd(param)
}

func (j *JobApp) ChangeStatus(jobId string, status string) {
	j.job.ChangeStatus(jobId, status)
}

func (j *JobApp) DeleteJob(jobIds string) {
	j.job.DeleteJob(jobIds)
}

func (j *JobApp) ClearJobLog() response.Response {
	return j.job.ClearJobLog()
}
